home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / trudf.zip / BLANK.C < prev    next >
Text File  |  1993-01-04  |  2KB  |  73 lines

  1. /*********
  2. * Author   : Jean-Pierre van Melis, Helmond, The Netherlands
  3. * Compiled : with Microsoft C 5.1    (cl /c /AL /Zl /Oailt /FPa /Gs blank.c)
  4. * Object   : can only be used in conjunction with Clipper summer '87
  5. * source   : is not tested with earlier versions of Clipper
  6.  
  7.              Jean-Pierre van Melis
  8.              Bleriotstraat 2
  9.              5703 HT  Helmond
  10.              The Netherlands
  11.  
  12. (this UDF was inspired by Tom Rettig's UDF with the same name.
  13.  but only it's function was copied, NOT the code.)
  14.  
  15. *
  16. * BLANK.C
  17. *
  18. *  Syntax: BLANK( <exp> )
  19. *  Return: Empty value of parameter passed:
  20. *          TYPE   RETURN          NOTE
  21. *          ----   --------------- ----------------------------------
  22. *             L   .F.             logical type
  23. *             N   0.00            numeric type
  24. *             D   '  /  /  '      date type
  25. *             C   "..."           len(<exp>) blank spaces
  26. *
  27. *********/
  28.  
  29. #include "jplib.h"
  30.  
  31. CLIPPER blank()
  32. {
  33.  
  34.    byte  *ret;
  35.    quant length, i;
  36.  
  37.    if ( PCOUNT == 1 )
  38.    {
  39.       switch ( _parinfo(1) )
  40.       {
  41.          case CHARACTER:
  42.  
  43.                         /* character string without defined format */
  44.                         length = (quant) (_parclen(1));
  45.                         ret    = _exmgrab(length+1);
  46.  
  47.                         if ( ret )     /* this branch must be last */
  48.                         {
  49.                            for ( i=0; i<length; i++ )
  50.                               ret[i] = SPACEC;
  51.                            ret[i] = NULLC;
  52.                            _retclen( ret, length);
  53.                            _exmback( ret,(length+1));
  54.                         }
  55.                         else
  56.                            _ret();
  57.  
  58.                         break;
  59.  
  60.          case LOGICAL  : _retl( FALSE ); break;
  61.          case NUMERIC  : _retnd( 0.0 ); break;
  62.          case DATE     : _retds( BLANKDS ); break;
  63.          default       : _ret();
  64.       }
  65.    }
  66.    else
  67.       _ret();
  68.  
  69.    return;
  70. }
  71. /* eof */
  72.  
  73.